require './test/test_helper'

# Public: Tests the Pyro command line interface.
#
# Example
#
#   ~/pyro $ rake test
class TestPyro
  # Tests the 'pyro serve' command.
  #
  # * The command is run in it's own thread so that
  #   control isn't passed to the server.
  #
  # Expects to not raise any errors.
  def test_serve
    server = Thread.new {
      Pyro::CLI.new.invoke :serve, [], environment: 'development'
    }
    sleep 1 until server.status == 'sleep'
    Thread.kill server
    server.join
  end

  # Tests the 'pyro burn' def command.
  #
  # Expects to not raise any errors.
  def test_burn
    Pyro::CLI.new.burn
  end
end